// 导入请求哈
import request from '@/utils/request'
// 获取顶部标签列表请求哈
const getuserHomeApi = () => {
  return request({
    method: 'get',
    url: '/v1_0/user/channels'
  })
}

// 获取文章列表// new Date().gettime获取当前的时间戳
const getArticlesApi = ({ channelId, timestamp = Date.now() }) => {
  // 一定要return出去外面才阔以拿到值的哈
  return request({
    method: 'get',
    url: '/v1_0/articles',
    params: {
      channel_id: channelId,
      timestamp
    }
  })
}
// artcileitem 中删除后台信息
const ArticlesItemApi = ({ articleId }) => {
  return request({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target: articleId
    }
  })
}
// artcileitem 中举报信息
const ArticlesItemPostApi = ({ target, type, remark }) => {
  return request({
    method: 'post',
    url: '/v1_0/article/reports',
    data: {
      target, type, remark
    }
  })
}
//  获取所有用户列表项
const ArticleAllchannels = () => {
  return request({
    method: 'get',
    url: '/v1_0/channels'
  })
}
// 更新频道
const genxinChannel = ({ channels }) => {
  return request({
    method: 'put',
    url: '/v1_0/user/channels',
    data: {
      channels
    }
  })
}
// 最后按需导出
export { getuserHomeApi, getArticlesApi, ArticlesItemApi, ArticlesItemPostApi, ArticleAllchannels, genxinChannel }
